package com.gdk.ksoft.data.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.gdk.ksoft.assembly.widget.BaseListItemView;

import java.util.ArrayList;

/**
 * Created by Mrper on 2014/11/21.
 * 列别数据适配器
 */
public class CategoryListAdapter extends BaseAdapter {

    private Context context;
    private ArrayList<BaseListItemView> itemlst;

    public CategoryListAdapter(Context context, ArrayList<BaseListItemView> itemlst){
        this.context = context;
        this.itemlst = itemlst;
    }

    @Override
    public int getCount() {
        return this.itemlst == null?0:this.itemlst.size();
    }

    @Override
    public Object getItem(int position) {
        return itemlst.get(position).getItem();
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return itemlst.get(position).getView(this.context,convertView,position);
    }
}
